<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <input type="text">
        <div></div>
    </div>
</body>
<script>
    const input = document.querySelector("#app input");
    const div = document.querySelector("#app div");
    const data = {
        str:"我现在过的很好！"
    };
    input.value = div.innerText = data.str;
    let _str = data.str;
    Object.defineProperty(data,"str",{
        get(){
            return _str;
        },
        set(v){
            _str = input.value= div.innerText =  v;
        }
    })
    input.addEventListener("input",function(e){
        data.str = e.target.value;
    })

</script>
</html>